package com.java8feature.java8action.genericBound;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description:
 * @Author: yangzhiwei
 * @Date: 2021/5/16 15:03
 */
public class GenericTest {

    public static void main(String[] args) {
        List<? extends B> list1 = new ArrayList<>();
        //list1.add(new A());

        List<? super B> list = new ArrayList<>();
        list.add(new B());
        list.add(new C());


        List<B> list8 = (List<B>) list;
        //list2.add(new B());


        list.add(new C());
        list.add(new B());

        for (B b : list8) {
            System.out.println(b.getClass().getName());
        }

    }

}
